Skip to content

test(oidc-auth): port the OIDC authorization tests to testkit - #5787

Merged
matthewgrossman merged 16 commits into
mainfrom
test/5731-port-oidc-auth-tests/matthewgrossman
Dec 1, 2026
Merged

matthewgrossman merged 16 commits into
mainfrom
test/5731-port-oidc-auth-tests/matthewgrossman

Conversation

@matthewgrossman

@matthewgrossman matthewgrossman commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Summary

Port the OIDC tests in e2e/rust/tests/oidc_pkce.rs to 13 testkit tests in tests/suites/features/oidc-auth. They run in a new <base>-oidc tmachine environment that reuses the Keycloak setup.

Related Issue

Closes #5731
Part of #5281

Builds on #5780's gateway_overrides role, environment contract table and typed Profile/Credential builders, now on main.

Changes

  • <base>-oidc environment (tests/tmachine): the oidc_gateway role applies an oidc override block through gateway_overrides. It sets [openshell.gateway.oidc] to trust the Keycloak realm and sets [openshell.gateway.mtls_auth] operator_enabled = true in place of enabled. It also re-signs testkit's client certificate as an operator (OU=operator), so testkit's own connection sets up and cleans up without signing in as a user. The suite's setup fails with a pointer to the role if the certificate signs in as a user.
    The block also sets [openshell.gateway.tls] to the paths generate-certs writes. config preflight (the unit's first ExecStartPre) accepts operator_enabled only with an explicit client CA, and doesn't pick up the local TLS files the packaged gateway otherwise finds on its own.
  • keycloak-support: User, Session (a signed-in user's SDK client and CLI), browser_login (the PKCE flow with a recorded xdg-open) and token-claim helpers. These are shaped so test(e2e): migrate the Python E2E suites to Rust #5624's oidc_authz.rs can move onto them.
  • testkit: Cli::without_env and Cli::in_workspace; Workspace::track_sandbox, track_provider and import_profile.
  • oidc-auth suite: 13 tests following the issue's mapping table. Per-user clients verify the gateway against its CA and send only a bearer token (no --gateway-insecure, no client certificate). Denials are checked by gRPC code and message. One CLI test checks the remediation command a workspace user sees.
  • CI: one row, ubuntu-docker-rootful-oidc with deb. All 13 tests pass there, so the suite has no tests/suites/unsupported.yaml entries. The test target is oidc-auth with harness = false and a testkit::main() entry point.
  • oidc_pkce.rs keeps only the 4 tests decision D drops: admin_can_delete_workspace, second_workspace_user_cannot_read_first_users_workspace, workspace_admin_can_create_sandbox and workspace_admin_can_delete_sandbox. The e2e:oidc-pkce tasks stay.

Notes for review:

  • The gateway has no built-in provider profiles, so tests import a small test profile into their workspace, or globally for the profile-resolve test, and delete it on cleanup.
  • The CLI-only "requires admin privileges" check is dropped; denials are asserted on the gateway's own messages (role 'openshell-admin' required, not a member of workspace '<ws>', and so on).
  • CI client variables and client_credentials_grant are left to test(e2e): migrate the Python E2E suites to Rust #5624.

Testing

  • cargo clippy -D warnings and cargo fmt for testkit, keycloak-support and the features workspace
  • oidc_pkce.rs compiles clean of new warnings with --features e2e-oidc-pkce
  • E2E tests added/updated
  • ubuntu-docker-rootful-oidc CI row passes

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)

@copy-pr-bot

copy-pr-bot Bot commented Nov 20, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the state:accepted A maintainer decided OpenShell should pursue this issue label Nov 20, 2026
@github-actions

Copy link
Copy Markdown

@matthewgrossman

Copy link
Copy Markdown
Member Author

/ok to test c29be49

@matthewgrossman matthewgrossman added the test:e2e Requires end-to-end coverage label Nov 20, 2026
@github-actions

Copy link
Copy Markdown

Label test:e2e applied for c29be49. Open the existing run and click Re-run all jobs to execute with the label set. The run will execute the standard E2E suite after building the required gateway, sandbox, and supervisor images once. The matching required CI gate status on this PR will flip green automatically once the run finishes.

@matthewgrossman

Copy link
Copy Markdown
Member Author

/ok to test 8b9ac69

@matthewgrossman

Copy link
Copy Markdown
Member Author

/ok to test 6740fa3

@matthewgrossman

Copy link
Copy Markdown
Member Author

/ok to test 82b5c06

@matthewgrossman
matthewgrossman force-pushed the test/5731-port-oidc-auth-tests/matthewgrossman branch 2 times, most recently from 7ed684b to 84a2058 Compare November 24, 2026 04:46
@matthewgrossman
matthewgrossman force-pushed the test/5731-port-oidc-auth-tests/matthewgrossman branch from 84a2058 to 1dc7b8b Compare November 24, 2026 06:00
@matthewgrossman
matthewgrossman changed the base branch from main to test/5728-share-environment-helpers/matthewgrossman November 24, 2026 06:00
Base automatically changed from test/5728-share-environment-helpers/matthewgrossman to main November 24, 2026 22:53
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
…eflight

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
…file

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
… list

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
…rkspace imports

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
@matthewgrossman
matthewgrossman force-pushed the test/5731-port-oidc-auth-tests/matthewgrossman branch from 1dc7b8b to 24bcadb Compare November 24, 2026 23:05
…uth-tests/matthewgrossman

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>

# Conflicts:
#	tests/suites/features/Cargo.toml
#	tests/tmachine/config.nix
@matthewgrossman
matthewgrossman marked this pull request as ready for review November 30, 2026 22:36
@matthewgrossman
matthewgrossman requested a review from a team as a code owner November 30, 2026 22:36

@TaylorMutch TaylorMutch left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gator-agent

PR Review Status

The initial code-only review found no blocking issues in the OIDC test migration, including bearer-only authentication, workspace authorization assertions, legacy coverage removal, and environment-owned Keycloak and operator certificate setup. Required checks and the selected OIDC suite are green; maintainer approval remains.

Action required: A maintainer should review and approve the PR.

Blocking findings: None.

Carried findings: None.

Gator metadata
  • Validation: Concentrated test migration closing #5731, part of #5281.
  • Docs: Published docs not needed for this internal test migration; testing/support documentation updated.
  • Checks: All current-head required checks pass: DCO, Branch Checks, E2E, and Helm Lint.
  • E2E: Existing test:e2e selected suites passed, including features/oidc-auth on ubuntu-docker-rootful-oidc. No workflows dispatched or approved.
  • Head SHA: e387e9f5bb51b436707a0803e4cca6aa8d28f9e5
  • Base SHA: 967c594c311007bc74969666502efa348a0ff41d
  • Merge base SHA: 967c594c311007bc74969666502efa348a0ff41d
  • Patch ID: c1ef44157453d62116c201ffc3cc912e6db73268
  • Gator payload: 16
  • Review mode: initial
  • Previous reviewed SHA: none
  • Review budget exhausted: no
  • Maintainer decision required: no
  • Next state: gator:approval-needed

@TaylorMutch TaylorMutch added the gator:approval-needed Gator completed review; maintainer approval needed label Dec 1, 2026
TaylorMutch
TaylorMutch previously approved these changes Dec 1, 2026

@TaylorMutch TaylorMutch left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved based on the completed current-head review with no blocking or carried findings and the approval-needed disposition.

@matthewgrossman
matthewgrossman added this pull request to the merge queue Dec 1, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Dec 1, 2026
…uth-tests/matthewgrossman

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>

# Conflicts:
#	tests/support/README.md
#	tests/testkit/testkit/src/gateway.rs
#	tests/testkit/testkit/src/lib.rs
@matthewgrossman
matthewgrossman added this pull request to the merge queue Dec 1, 2026
Merged via the queue into main with commit 52c1a31 Dec 1, 2026
415 of 422 checks passed
@matthewgrossman
matthewgrossman deleted the test/5731-port-oidc-auth-tests/matthewgrossman branch December 1, 2026 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gator:approval-needed Gator completed review; maintainer approval needed state:accepted A maintainer decided OpenShell should pursue this issue test:e2e Requires end-to-end coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(e2e): port OIDC authorization tests from e2e/rust to features/oidc-auth

2 participants